package com.ysz.component.conf;

import com.ysz.component.constant.MyBatisConst;
import com.ysz.component.tableshard.MyBatisTableShardInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * @ClassName MyBatisTableShardInterceptorConfig
 * @Description TODO
 * @Data 14:32
 * @Version 1.0
 * @Author ysz
 */
@Configuration
public class MyBatisTableShardInterceptorConfig {

    @Bean
    public MyBatisTableShardInterceptor tableShardInterceptor() {
        Properties properties = new Properties();
        properties.setProperty(MyBatisConst.sql_table_shard.getKey(), MyBatisConst.sql_table_shard_enable.getValue());
        MyBatisTableShardInterceptor myBatisTableShardInterceptor = new MyBatisTableShardInterceptor();
        myBatisTableShardInterceptor.setProperties(properties);
        return myBatisTableShardInterceptor;
    }
}
